package com.ssy.lingxi.member.merchant.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 用户（业务员）管理的下级渠道
 * @author 万宁
 * @version 2.0.0
 * @date 2021-04-13
 */
@Entity
@Table(schema = "public", name = "ms_mc_member_user_channel", indexes = {@Index(name = "ms_mc_member_user_channel_member_id_idx", columnList = "memberId"), @Index(name = "ms_mc_member_user_channel_role_id_idx", columnList = "roleId"), @Index(name = "ms_mc_member_user_channel_sub_member_id_idx", columnList = "subMemberId"), @Index(name = "ms_mc_member_user_channel_sub_role_id_idx", columnList = "subRoleId"), @Index(name = "ms_mc_member_user_channel_user_id_idx", columnList = "userId"), @Index(name = "ms_mc_member_user_channel_relation_id_idx", columnList = "memberRelationId")})
public class MemberUserChannelDO implements Serializable {
    private static final long serialVersionUID = 4266765345099868158L;

    /**
     * 主键Id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="member_user_channel_seq")
    @SequenceGenerator(sequenceName="ms_mc_member_user_channel_seq", name="member_user_channel_seq",allocationSize = 1)
    private Long id;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "timestamp")
    private LocalDateTime createTime;

    /**
     * 会员Id
     */
    @Column
    private Long memberId;

    /**
     * 角色Id
     */
    @Column
    private Long roleId;

    /**
     * 会员上下级关系Id
     */
    @Column
    private Long memberRelationId;

    /**
     * 用户Id
     */
    @Column
    private Long userId;

    /**
     * 下级渠道会员Id
     */
    @Column
    private Long subMemberId;

    /**
     * 下级渠道会员角色Id
     */
    @Column
    private Long subRoleId;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public Long getMemberRelationId() {
        return memberRelationId;
    }

    public void setMemberRelationId(Long memberRelationId) {
        this.memberRelationId = memberRelationId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getSubMemberId() {
        return subMemberId;
    }

    public void setSubMemberId(Long subMemberId) {
        this.subMemberId = subMemberId;
    }

    public Long getSubRoleId() {
        return subRoleId;
    }

    public void setSubRoleId(Long subRoleId) {
        this.subRoleId = subRoleId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }

        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        MemberUserChannelDO that = (MemberUserChannelDO) o;
        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
